#include <iostream>
int main()
{
	int stude_num, revise_num,start,end,subtract,max=0;
	std::cin >> stude_num >> revise_num;
	int* student_scores = new int[stude_num];
	for (int i = 0; i < stude_num; i++)    std::cin >> student_scores[i];
	for (int i = 0; i < revise_num; i++)
	{
		std::cin >> start >> end >> subtract;
		for (int j = start - 1; j < end; j++)
		{
			student_scores[j] -= subtract;
			if (student_scores[j] > max)
			{
				max = student_scores[j];
			}
		}
	}
	std::cout << max;
	return 0;
}